#从框架中引入 标准模板 数据模型
from django.db import models

#创建数据模型 实质ORM 关系映射 类--表
class Users(models.Model):
    ## 属性 --- 字段 设置字段数据类型 字符型models.CharField
    ##数值型
    ##models.DecimalField() 时间型models.DateTimeField()
    uid = models.AutoField(primary_key=True)
    username = models.CharField(max_length=32)
    userpsd = models.CharField(max_length=32)

class Goods(models.Model):
    #{'id': 1, 'name': '西瓜', 'imgsrc': '/static/img/logo.jpg', 'price': 3.9, 'count': 4}
    gid = models.AutoField(primary_key=True)
    name = models.CharField(max_length=32)
    imgsrc = models.CharField(max_length=64)
    price = models.DecimalField(max_digits=10, decimal_places=2)
    count = models.DecimalField(max_digits=10, decimal_places=0)

class Cars(models.Model):
    cid = models.AutoField(primary_key=True)
    gid = models.DecimalField(max_digits=10, decimal_places=0)
    buy_count = models.DecimalField(max_digits=10, decimal_places=0)
    uid = models.DecimalField(max_digits=10, decimal_places=0)